﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("**********While***********");
            double i = 1, sum = 1;
            while (i < 100)
            {
                sum += (i / (i + 1));
                i++;
            }
            Console.WriteLine("数列的和为{0}", sum);
            Console.WriteLine();
            Console.WriteLine("**********Do While***********");
            i = 1; sum = 1;
            do
            {
                sum +=( i / (i + 1));
                i++;
            } while (i < 100);
            Console.WriteLine("数列的和为{0}", sum);
            Console.WriteLine();
            Console.WriteLine("**********for***********");
            i = 1; sum = 1;
            for ( i = 1; i < 100; i++)
            {
                sum +=( i / (i + 1));
            }
            Console.WriteLine("数列的和为{0}", sum);
            Console.ReadKey();

        }
    }
}
